<!doctype html>
<html>
    <head>
        <meta charset="UTF-8"/>
        <title>城市管理</title>
	    <link rel="stylesheet" type="text/css" href="/webapp/css/easyui.css">
	    <link rel="stylesheet" type="text/css" href="/webapp/css/icon.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/color.css">
        <link rel="stylesheet" type="text/css" href="/webapp/css/public.css">
	    <script type="text/javascript" src="/webapp/js/lib/jquery.min.js"></script>
	    <script type="text/javascript" src="/webapp/js/lib/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="/webapp/js/lib/jquery.global.settings.js"></script>
	    <script type="text/javascript" src="/webapp/js/lib/ajaxfileupload.js"></script>
	    <script type="text/javascript" src="/webapp/js/common/config.js"></script>
        <script type="text/javascript" src="/webapp/js/common/cities.js"></script>
    </head>
    <body>
       <div class="easyui-container-fluid">
          <div class="easyui-panel" style="border:none;">
            <div class="nav" id="nav"></div> 
           	<div class="easyui-panel" style="width: 100%;border:none;">
           		<form id="ff">
                <div style="margin-bottom:20px;">
                  <label class="item-label">代码：</label>
                  <input type="text" name="code" class="easyui-textbox" style="width:100px;"/>
                  <label class="item-label">名称：</label>
                  <input type="text" name="name"  class="easyui-textbox" style="width:100px;"/>
                  <label class="item-label">省份：</label>
                  <select name="provinceCode" class="easyui-combobox" id="province" data-options="panelHeight:'auto'" style="width:100px;">
                  </select>
                  <label class="item-label">隶属城市：</label>
                  <select name="belongingCityCode" id="belongingCity" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:100px;">
                  </select>         

                  <label class="item-label">市场级别：</label>
                   <select name="marketLevel" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:100px;">
                      <option value="">-请选择-</option>
                      <option value="ONE">一级市场</option>
                      <option value="TWO">二级市场</option>
                      <option value="THREE">三级市场</option>
                      <option value="FOUR">四级市场</option>
                  </select>
                  <label class="item-label">城市级别：</label>
                  <select name="cityLevel" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:100px;">
                      <option value="">-请选择-</option>
                      <option value="ONE">一线城市</option>
                      <option value="TWO">二线城市</option>
                      <option value="THREE">三线城市</option>
                      <option value="FOUR">四线城市</option>
                  </select>
                </div>
                <div style="margin-bottom:20px;">
                  <label class="item-label">南北方：</label>
                  <select name="north" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:100px;">
                      <option value="">-请选择-</option>
                      <option value="true">北方</option>
                      <option value="false">南方</option>      
                  </select>
                  <label class="item-label">城市区域：</label>
                  <select name="area" class="easyui-combobox" data-options="panelHeight:'auto'" style="width:100px;">
                      <option value="">-请选择-</option>
                      <option value="NORTH_EAST">东北地区</option>
                      <option value="NORTH">华北地区</option>
                      <option value="EAST">华东地区</option>
                      <option value="SOUTH">华南地区</option>    
                      <option value="MIDDLE">华中地区</option>
                      <option value="SOUTH_WEST">西南地区</option>
                      <option value="NORTH_WEST">西北地区</option>
                  </select>
                  <a class="easyui-linkbutton c8" style="width:80px;" href="javascript:void(0);" onclick="searchBy()">查询</a>
                </div>
	        	</form>
          	</div>
            <div class="table-wrapper">
             <table id="datagrid" data-options="fitColumns:true,scrollbarSize:0">
               <thead>
                 <tr>
                   <th data-options="field:'code',align:'center'" width="80">代码</th>
                   <th data-options="field:'province',align:'center',formatter:subProFormatter" width="100">省份</th>
                   <th data-options="field:'name',align:'center'" width="100">市/县</th>
                   <th data-options="field:'belongingCityName',align:'center'" width="100">隶属城市</th>
                   <th data-options="field:'cityLevel',align:'center',formatter:cityLevelFormatter" width="100">城市级别</th>
                   <th data-options="field:'cityScale',align:'center',formatter:cityScaleFormatter" width="80">城市规模</th>
                   <th data-options="field:'marketLevel',align:'center',formatter:marketLevelFormatter" width="100">市场级别</th>
                   <th data-options="field:'north',align:'center'" width="80">南北方</th>
                   <th data-options="field:'area',align:'center',formatter:areaFormatter" width="100">城市区域</th>
                   <th data-options="field:'entityStatus',align:'center',formatter:statusFormatter" width="80">状态</th>
                   <th data-options="field:'action',align:'center',formatter:actions" width="180">操作</th>
                 </tr>
               </thead>
               <tbody>
               </tbody>
             </table>
           </div>
          </div> 
       </div>  
    </body>
    <script type="text/javascript">
           $(function() {
               initProvinceCombobox('province', "", "belongingCity");
               aRecords("城市管理","/webapp/pages/channel/city")
               var height = $(window).height();
               var nav_height = $("#nav")._outerHeight();
               var ff_height = $("#ff").height();
               var table_height = height-nav_height-ff_height-40;
               $("#datagrid").css("max-height",table_height);
               $("#datagrid").datagrid({
                   toolbar: [{
                       text: '添加城市',
                       handler: function () {
                           window.location.href = "/webapp/pages/channel/city/add.html";
                       }
                   }]
               });
           });
           function subProFormatter(val){
              return val?val.name:"";
           }
           function marketLevelFormatter(val){
        	   switch(val){
        	   	case "ONE":
        	   		return "一级市场";
        	   	case "TWO":
    	   			return "二级市场";
        	   	case "THREE":
    	   			return "三级市场";
        	   	case "FOUR":
    	   			return "四级市场";
        	   	default:
        	   		return "未分级";
        	   	
        	   }
           }
           function cityLevelFormatter(val){
        	   switch(val){
	       	   	case "ONE":
	       	   		return "一线城市";
	       	   	case "TWO":
	   	   			return "二线城市";
	       	   	case "THREE":
	   	   			return "三线城市";
	       	   	case "FOUR":
	   	   			return "四线城市";
	       	   	default:
	       	   		return "未分级";
	       	   }
           }
           function cityScaleFormatter(val){
	       	 switch(val){
	    	   	case "TINY":
	    	   		return "县城";
	    	   	case "SMALL":
		   			return "小";
	    	   	case "MIDDLE":
		   			return "中";
	    	   	case "BIG":
		   			return "大";
	    	   	case "HUGE":
	   				return "特大";
	    		case "SUPER":
   					return "超大";
	    	   	default:
	    	   		return "未分级";
	    	   }
           }
           
           function areaFormatter(val){
        	   switch(val){
	    	   	case "NORTH":
	    	   		return "华北";
	    	   	case "NORTH_EAST":
		   			return "东北";
	    	   	case "NORTH_WEST":
		   			return "西北";
	    	   	case "EAST":
		   			return "华东";
	    	   	case "MIDDLE":
	   				return "华中";
	    		case "SOUTH":
  					return "华南";
	    		case "SOUTH_WEST":
					return "西南";
	    	   	default:
	    	   		return "未分级";
	    	   }
           }
      </script>
    <script type="text/javascript" src="/webapp/js/common/pagelist.js"></script>

    <script type="text/javascript">
        function edit(id){
            window.parent.addTab("修改城市","/webapp/pages/channel/city/add.html?id="+id);
        }
    </script>
</html>
